package com.tvunetworks.center.user.service;

import com.tvunetworks.center.common.model.LoginUser;
import com.tvunetworks.center.common.util.Result;
import com.tvunetworks.center.user.model.RoleUser;
import com.tvunetworks.center.user.model.param.AddRoleUserParam;
import com.tvunetworks.center.user.model.param.GetSonUserNoRelationRoleIdParam;
import com.tvunetworks.center.user.model.param.GetUserByRoleIdParam;
import com.tvunetworks.center.user.model.vo.RoleUserVo;

import java.util.List;

/**
 * @author Etan Yang
 * @data: 2021/4/9 16:34
 * @program: tvucc-aggregator
 * @description:
 */

public interface RoleUserService {
    /**
     * 根据roleId获取所有的用户信息
     * @param roleId roleId
     * @return List
     */
    List<RoleUser> getByRoleId(String roleId);

    /**
     * 根据roleId删除roleUser
     * @param roleId roleId
     * @return int
     */
    int deleteByRoleId(String roleId);

    /**
     * 根据userId和roleId创建RoleUser
     * @param roleId roleId
     * @param userId userId
     * @return int
     */
    int addRoleUser(String roleId, String userId);

    /**
     * 根据userId获取RoleUser
     * @param userId userId
     * @return RoleUser
     */
    RoleUser getByUserId(String userId);

    /**
     * 删除指定的roleUser对象
     * @param roleUser roleUser
     * @return int
     */
    int deleteByRoleUser(RoleUser roleUser);

    /**
     * 根据userId获取roleId和roleName
     * @param userId userId
     * @return RoleUserVo
     */
    RoleUserVo getUserRoleVoByUserId(String userId);

    /**
     * 查询指定role下面的所有子用户
     * @param loginUser loginUser
     * @param param param
     * @return Result
     */
    Result<Object> pageUserByRoleId(LoginUser loginUser, GetUserByRoleIdParam param);

    /**
     * 处理用户和role之间的关系
     * @param loginUser loginUser
     * @param param param
     * @return Result
     */
    Result<Object> add(LoginUser loginUser, AddRoleUserParam param);

    /**
     * 根据userId修改roleId
     * @param userId userId
     * @param roleId roleId
     * @return int
     */
    int updateRoleIdByUserId(String userId, String roleId);

    /**
     * 根据userId删除roleUser
     * @param loginUser loginUser
     * @param userId userId
     * @return Result
     */
    Result<Object> delete(LoginUser loginUser, String userId);

    /**
     * 根据UserId删除RoleUser
     * @param userId userId
     * @return  int int
     */
    int deleteByUserId(String userId);

    /**
     * 获取admin账号下没有该role的子账号
     * @param loginUser loginUser
     * @param param param
     * @return Result
     */
    Result<Object> getSonUserNoRelationRoleId(LoginUser loginUser, GetSonUserNoRelationRoleIdParam param);
}
